/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.constant.enums;

import com.comac.ins.common.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;


/**
 * 模型渲染任务枚举
 *
 * @author lj
 * @date 2024-9-5
 */
@AllArgsConstructor
@Getter
public enum IsfdModelManagementRenderingTypeEnum {

    PART("part", "零件"),
    TASK("task", "任务");
    private final String value;
    private final String desc;

    public static String getDescByValue(String value) {
        IsfdModelManagementRenderingTypeEnum isfdModelManagementRenderingTypeEnum = forValue(value);
        if (isfdModelManagementRenderingTypeEnum == null) {
            return null;
        }
        return isfdModelManagementRenderingTypeEnum.getDesc();
    }

    public static IsfdModelManagementRenderingTypeEnum forValue(String value) {
        if (StringUtils.isBlank(value)) {
            return null;
        }
        for (IsfdModelManagementRenderingTypeEnum isfdModelManagementRenderingTypeEnum : IsfdModelManagementRenderingTypeEnum.values()) {
            if (isfdModelManagementRenderingTypeEnum.getValue().equals(value)) {
                return isfdModelManagementRenderingTypeEnum;
            }
        }
        return null;
    }

    public static IsfdModelManagementRenderingTypeEnum forDesc(String desc) {
        if (desc == null) {
            return null;
        }
        for (IsfdModelManagementRenderingTypeEnum isfdModelManagementRenderingTypeEnum : IsfdModelManagementRenderingTypeEnum.values()) {
            if (desc.equals(isfdModelManagementRenderingTypeEnum.getDesc())) {
                return isfdModelManagementRenderingTypeEnum;
            }
        }
        return null;
    }
}
